package org.example.domain.controller;

import com.aya.export.annotation.ExcelExport;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.example.domain.dto.DomainNestPageNoReq;
import org.example.domain.entity.Domain;
import org.example.domain.service.DomainService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PageNoInNestedPropertyController {
    private final DomainService domainService;

    public PageNoInNestedPropertyController(DomainService domainService) {
        this.domainService = domainService;
    }

    /**
     * 当前类有pageNo
     * @param domainReq
     * @return
     */
    @GetMapping("/domains/nested")
    public IPage<Domain> listDomains(DomainNestPageNoReq domainReq) {
        return domainService.getDomainPage(domainReq.getPageReq().getPage(), domainReq.getPageReq().getSize());
    }

    @ExcelExport(queryMethod = "listDomains",pageSwitch = "nested:pageReq.page")
    @GetMapping("/domains/nested/export")
    public void listDomainsExport(DomainNestPageNoReq domainReq) {
    }
}
